<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');

$semester_id = mysql_real_escape_string(strip_tags($_POST['id']));

$get_semester_data=mysql_query("SELECT * 
								FROM seasons 
								JOIN semesters
								ON semesters.season_id=seasons.id
								WHERE semesters.id='$semester_id'");
								
$year=mysql_result($get_semester_data,0,"semesters.year");
$season=mysql_result($get_semester_data,0,"seasons.season");

echo "<h1>Delete Semester</h1>";

$query = "DELETE FROM semesters WHERE id='$semester_id'";
$result = mysql_query($query);

if ($result)
{
	echo "<b>$season $year</b> has been successfully deleted!";
	echo "<br />";
}
else
{
	echo "<b>$season $year</b> was NOT able to be deleted at this time!";
	echo "<br />";
}

//close
mysql_close();

echo "<p>";
	echo "<a href='index.php'>&lt;&lt; Back to Semesters Portal</a><br />";
echo "</p>";
?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>